#include<stdio.h>
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;

#ifndef TEXT_COLOR
#define TEXT_COLOR
const unsigned int TEXT_DEFAULT = 0;
const unsigned int TEXT_BOLD = 1;
const unsigned int TEXT_GRAY = 30;
const unsigned int TEXT_GREEN = 92;
const unsigned int TEXT_YELLOW = 93;
const unsigned int TEXT_RED = 31;
const unsigned int TEXT_BLUE = 34;
const unsigned int TEXT_CYAN = 36;

/* C functions which introduce a some color to your programs */
inline void gotoxy(int wiersz, int kolumna)
{ printf("\033[%d;%dH", kolumna+1, wiersz+1); }

inline void cleanScrean()
{
	printf("\033c");
	return;
}

inline void cleanLine(int y) 
{
	gotoxy(0,y);
	printf("\033[2K");
	return;
}

inline void cleanBelowLine(int y)
{
	gotoxy(0,y);
	printf("\033[J");
	return;
}

/* If you want to find more functons like it use following script:
 * for X in `seq 110 `; do echo -en "\033[${X}m ${X} \e[0m "; done; echo ""
*/
inline void textDefault() { printf("\033[0m"); return;}
inline void textBold() { printf("\033[1m"); return;}
inline void textUnderlined() { printf("\033[4m"); return;}
inline void textBlinking()    { printf("\033[5m"); return;}
inline void textColorInversion()    { printf("\033[7m"); return;}
inline void textColorNr(int i)  { printf("\033[0;%dm", i); return;}
inline void textColor2Nr(int i, int j)  { printf("\033[0;%d;%dm", i, j); return;}

inline void textColor(unsigned int i, string s)
{
	textColorNr(i);
	cout << s;
	textDefault();
	return;
}

inline void textInverse(string s)
{
	textColorInversion();
	cout << s;
	textDefault();
	return;
}

inline void textRed(string s) { textColor(31, s); }
inline void textBlue(string s) { textColor(34, s); }
inline void textCyan(string s) { textColor(36, s); }
inline void textGreen(string s) { textColor(92, s); }
inline void textYellow(string s) { textColor(93, s); }
#endif
